package info.xingxingdd.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import info.xingxingdd.admin.entity.ClientUser;
import info.xingxingdd.admin.mapper.ClientUserMapper;
import info.xingxingdd.admin.service.ClientUserService;
import org.springframework.stereotype.Service;

/**
 * 客户端用户服务实现类
 */
@Service
public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientUser> implements ClientUserService {
    
    /**
     * 根据账户查询用户
     * @param account 账户
     * @return 用户信息
     */
    @Override
    public ClientUser getByAccount(String account) {
        LambdaQueryWrapper<ClientUser> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(ClientUser::getAccount, account);
        return getOne(wrapper);
    }
    
    /**
     * 验证用户密码
     * @param rawPassword 原始密码
     * @param encodedPassword 编码后的密码
     * @return 是否匹配
     */
    @Override
    public boolean verifyPassword(String rawPassword, String encodedPassword) {
        // 这里简单实现，直接比较原始密码和数据库中的密码
        // 实际应用中应该使用加密算法，如BCrypt
        return rawPassword.equals(encodedPassword);
    }
} 